<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>组织生活申报</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#checkAll").on('click', function() {
				//复选框
				var ch = this.checked;
				if (ch) {
					$("input[name='ids']").prop("checked", true);
				} else {
					$("input[name='ids']").prop("checked", false);
				}
			});
			getCheckList = function() {
				var ids = [];
				$("input[name='ids']:checked").each(function() {
					ids.push($(this).val());
				});
				return ids;
			}
			
			$("#btnAdd").click(function(){

						$("#searchForm").attr("action","${ctx}/life/organizeLifeJh/form");
						$("#searchForm").submit();
					
			});
					
		$("#btnCh").on('click', function() {
						var ids = getCheckList();
						if (ids.length < 1) {
							alert("请选择一条记录进行提交");
							return false;
						}
						$.ajax({
							type : 'POST',
							url : "${ctx}/life/organizeLifeCx/chehui/" + ids,
							type : "get",
							dataType : "json",
							async : false,//同步  
							success : function(result) {		
								if(result.type == "success"){
									
									top.$.jBox.confirm("组织生活积分申请已撤回！","系统提示",function(v,h,f){
										if(v=="ok"){
										    window.location.reload();//刷新当前页面.

										}else{
											window.location.reload();//刷新当前页面.
										}
									},{buttonsFocus:1});
									top.$('.jbox-body .jbox-icon').css('top','55px');
								} else {
									$.jBox.info("组织生活积分申请撤回失败！");
								}
							}
						});
					});

				});
		function page(n, s) {
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
			return false;
		}
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a>组织生活积分管理</a></li>
	</ul>
	<form:form id="searchForm" modelAttribute="organizeLife" action="${ctx}/life/organizeLifeCx/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
				<input type="hidden" name="ids" id="ids">
		
<ul class="ul-form">
            <li><label >活动名称：</label>
				<form:input path="lifename" htmlEscape="false" maxlength="64" class="input-medium"/>
			</li>
		    
			<li><label style="margin-left: 20px;">分类：</label>
				<form:select path="typeids" class="input-medium" >
							<form:option value="" label="全部"/>
							<form:options items="${organizeLifeTypes}" itemLabel="typename" itemValue="id" htmlEscape="false"/>
						</form:select>
			</li>
			<li><label style="margin-left: 20px;">计划状态：</label>
				<form:select style="width:150px" path="jhstate" class="input-medium">
					<form:option value="" label="全部"/>
					<form:options items="${fns:getDictList('life_state_flag')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>
			</li>
			
			
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></li>
			<li class="btns"><input id="btnCh" class="btn btn-primary" type="button" value="撤回"/></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
			<th width="2%" style='text-align: center'><input
					type="checkBox" id="checkAll" /></th>
				<th style="width: 5px;">序号</th>
				<th style="width:20%">活动名称</th>
				<th>分类</th>
				<th>计划状态</th>
				<th>审核状态</th>
				<th>计划时间</th>
				<th style="width:20%">活动地点</th>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="organizeLife" varStatus="rowIndex">
			<tr>
			    <td style='text-align: center'><input type='checkbox' id='ids' name='ids' value='${organizeLife.id}' /></td>
					<td style='text-align: center'>${rowIndex.index+1}</td>
				<td><a href="${ctx}/life/organizeLife/form?id=${organizeLife.id}">
					${organizeLife.lifename}
				</a></td>
				<td>
					${organizeLife.typeids}
				</td>
				<td style='text-align: center'>
					${fns:getDictLabel(organizeLife.jhstate, 'life_state_flag', '')}
				</td>
				<td style='text-align: center'>
					${fns:getDictLabel(organizeLife.shstate, 'life_approve_status', '')}
				</td>
                <td style='text-align: center'>
					<fmt:formatDate value="${organizeLife.jhtime}" pattern="yyyy-MM-dd HH:mm"/>
				</td>
				
				<td>
					${organizeLife.adress}
				</td>
				
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>